CREATE TABLE ozekimessagein (
  id int,
  sender varchar(30) default NULL,
  receiver varchar(30) default NULL,
  msg varchar(160) default NULL,
  operator varchar(120) default NULL,
  msgtype varchar(160) default NULL,
  senttime varchar(100) default NULL,
  receivedtime varchar(100) default NULL,
  reference varchar(100) default NULL
);

--CREATE SEQUENCE X;

--CREATE TRIGGER ozekimessagein_auto BEFORE INSERT on ozekimessagein
--for each row
--when (new.id is null)
--begin
--   SELECT x.nextval INTO :new.id FROM DUAL;
--end;
--/
ALTER TABLE ozekimessagein ADD CONSTRAINT ozekimessagein_PK PRIMARY KEY ( id ) ;

CREATE TABLE ozekimessageout (
  id int,
  sender varchar(30) default NULL,
  receiver varchar(30) default NULL,
  msg varchar(160) default NULL,
  senttime varchar(100) default NULL,
  receivedtime varchar(100) default NULL,
  operator varchar(120) default NULL,
  msgtype varchar(160) default NULL,
  reference varchar(100) default NULL,
  status varchar(20) default NULL
);

--CREATE SEQUENCE Y;

--CREATE TRIGGER ozekimessageout_auto BEFORE INSERT on ozekimessageout
--for each row
--when (new.id is null)
--begin
--   SELECT y.nextval INTO :new.id FROM DUAL;
--end;
--/
ALTER TABLE ozekimessageout ADD CONSTRAINT ozekimessageout_PK PRIMARY KEY ( id ) 

create sequence ozekimessagein_seq increment by 1 start with 1 nocache;
CREATE OR REPLACE TRIGGER ozekismsin_auto BEFORE INSERT on ozekimessagein
for each row
WHEN (new.id is null)
begin
SELECT ozekimessagein_seq.nextval INTO :new.id FROM DUAL;
end;
/

create sequence ozekimessageout_seq increment by 1 start with 1 nocache;
CREATE OR REPLACE TRIGGER ozekismsout_auto BEFORE INSERT on ozekimessageout
for each row
WHEN (new.id is null)
begin
SELECT ozekimessageout_seq.nextval INTO :new.id FROM DUAL;
end;
/